import 'package:my_flutter_core/my_flutter_core.dart';

class UserActiveToken {
  UserActiveToken({
    this.id,
    this.deviceId,
    this.deviceModel,
    this.enabled,
    this.lastUpdated,
  });

  factory UserActiveToken.fromJson(Map<String, dynamic> json) {
    return UserActiveToken(
      id: json['id']?.toString(),
      deviceId: json['deviceId']?.toString(),
      deviceModel: json['deviceModel']?.toString(),
      enabled: tryToConvert<bool>(json['enabled'], (p) => p as bool),
      lastUpdated: tryToConvert<DateTime>(
        json['lastUpdated'],
        (p) => parseDate(p),
      ),
    );
  }

  String? id;
  String? deviceId;
  String? deviceModel;
  bool? enabled;
  DateTime? lastUpdated;
}
